package com.gjy.spring.b02;

import org.springframework.beans.factory.support.DefaultListableBeanFactory;
import org.springframework.context.annotation.ClassPathBeanDefinitionScanner;

/**
 * @author 宫静雨
 * @version 1.0
 * @since 2023-12-18 16:18:27
 */
public class IndexedTest {

    public static void main(String[] args) {
        DefaultListableBeanFactory beanFactory = new DefaultListableBeanFactory();
        ClassPathBeanDefinitionScanner scanner = new ClassPathBeanDefinitionScanner(beanFactory);
        scanner.scan(IndexedTest.class.getPackage().getName());

        for (String s : beanFactory.getBeanDefinitionNames()) {
            System.out.println(s);
        }

        System.out.println(beanFactory.getBean("bean2"));
    }
}
